For drawables that are double buffered, the contents of the back buffer can be made potentially visible, i.e. become the contents of the front buffer, by calling
void glXSwapBuffers ( Display *dpy , GLXDrawable drawable ) ;
The contents of the back buffer then become undefined. This operation is a no-op if drawable was created with a non-double-buffered visual.
All GLX rendering contexts share the same notion of which are front buffers and which are back buffers for a given drawable. This notion is also shared with the X multi-buffering extension.
When multiple threads are rendering to the same drawable, only one of them need call glXSwapBuffers and all of them will see the effect of the swap. The client must synchronize the threads that perform the swap and the rendering, using some means outside the scope of GLX, to insure that each new frame is completely rendered before it is made visible.
If dpy and drawable are the display and drawable for the calling thread's current context, glXSwapBuffers performs an implicit glFlush(). Subsequent OpenGL commands can be issued immediately, but will not be executed until the buffer swapping has completed, typically during vertical retrace of the display monitor.
If drawable is not a valid GLX drawable, glXSwapBuffers generates a GLXBadDrawable error. If dpy and drawable are the display and drawable associated with the calling thread's current context, and if drawable is a window that is no longer valid, a GLXBadCurrentWindow error is generated.